package com.wdh.testq.dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.TextView;

import com.wdh.testq.R;

/**
 * School_Fellow
 * <p>
 * Created by xuminmin on 2019/3/27.
 * Email: iminminxu@gmail.com
 * 选择图片弹框
 */
public class ChoosePictureDialog extends BaseDialog {


    private TextView tvCamera;
    //相册
    private TextView tvPhoto;
    //取消
    private TextView tvCancel;

    public ChoosePictureDialog(Context mContext) {
        super(mContext);
    }

    @Override
    protected int getResource() {
        return R.layout.dialog_choose_picture;
    }

    @Override
    protected void initView() {
        setRate(1f);
        mDialog.getWindow().getAttributes().gravity = Gravity.BOTTOM;
        tvCamera = getRootView().findViewById(R.id.tv_camera);
        tvPhoto = getRootView().findViewById(R.id.tv_photo);
        tvCancel = getRootView().findViewById(R.id.tv_cancel);
    }

    @Override
    protected void initListener() {
        addSetOnClickListener(tvCamera);
        addSetOnClickListener(tvPhoto);
        addSetOnClickListener(tvCancel);
    }

    @Override
    protected void doOnClick(View v) {
        switch (v.getId()) {
            case R.id.tv_camera:
                if (vClickListener != null) {
                    vClickListener.onClick(v);
                }
                break;
            case R.id.tv_photo:
                if (vClickListener != null) {
                    vClickListener.onClick(v);
                }
                break;
            case R.id.tv_cancel:
                break;
        }
        hideDialog();
    }

    @Override
    protected boolean getCancelable() {
        return true;
    }
}